package com.cisc.nacos.controller;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @description: XXX
 * @author: daizh
 * @time: 2021/6/19 10:33
 */

@RefreshScope
@RestController
@RequestMapping("/config")
public class NacosController {

    @Value("${config.username}")
    String userName;

    @Value("${config.userage}")
    int age;

    @GetMapping("/username")
    public String getUserName() {
        return this.userName;
    }

    @GetMapping("/age")
    public int getAge() {
        return this.age;
    }
}
